package com.shanghaionstar.login.Model;

import com.onstar.cn.common.util.CommonUtil;

/**
 * Created by 6335yz on 2016/5/5.
 */
public class UserModel implements IUser {

    public UserModel(String name, String password) {
        this.name = name;
        this.password = password;
    }

    private String name;
    private String password;

    @Override
    public String getName() {
        return name;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public ValidityResult checkUserValidity(String name, String passwd) {
        if (CommonUtil.isNull(name)
                && CommonUtil.isNull(passwd)) {
            return ValidityResult.CREDENTIAL_ALL_NULL;
        }
        if (CommonUtil.isNull(name)
                || CommonUtil.isNull(passwd)) {
            return ValidityResult.CREDENTIAL_ONE_NULL;
        }
        return ValidityResult.CREDENTIAL_OTHER;
    }
}
